<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="cn.lei.Student"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<!-- EL从域中取出数据（EL最重要的作用）  -->
	<%
		//获得普通字符串
		pageContext.setAttribute("name", "lisi");
		request.setAttribute("name", "zhangsan");
		//获得Student对象
		Student student = new Student("zhangsan",34,"nan");
		session.setAttribute("student", student);
		//获得List<Student>集合
		List<Student> list = new ArrayList<Student>();
		Student student2 = new Student("张三1",34,"男");
		Student student3 = new Student("张三2",35,"男");
		list.add(student2);
		list.add(student3);
		application.setAttribute("list", list);
	
	%>
	<!-- 获得普通字符串 -->
	<!-- 使用jsp获取表达式域中值 -->
	<%=pageContext.getAttribute("name") %>
	<%=request.getAttribute("name") %>
	<!-- EL表达式获取域中值 -->
	${pageScope.name}<br>
	${requestScope.name}<br>
	
	
	<!-- 获得Student对象 -->
	<!-- 使用jsp获取表达式域中值 -->
	<%
	
		Student stu = (Student)session.getAttribute("student");
	%>
	<%=stu.getName() %>
	<%=stu.getGender() %>
	<!-- EL表达式获取域中值 -->
	${sessionScope.student.name} -- ${sessionScope.student.gender}
	<hr>
	
		
	<!-- 获得List<Student>对象 -->
	<!-- 使用jsp获取表达式域中值 -->
	<%
		List<Student> list2 = (List<Student>)application.getAttribute("list");
	%>
	<%=list2.get(0).getName() %>
	${applicationScope.list[0].name}
	<hr>
	
	
	<!-- 使用EL表达式全域自动查找 -->
	${ naem}<br>
	${student.name }<br>
	${list[0].name}<br>
</body>
</html>